<include file="App/Home/View/Public/header.html"/>

<!-----------------------------头部 结束------------------------------>
<script type="text/javascript"> 
//显示灰色 jQuery 遮罩层 
function showBg(id) { 
var bh = $("body").height(); 
var bw = $("body").width(); 
$("#type").val(id);
$(".fullbg").css({ 
height:bh, 
width:bw, 
display:"block" 
}); 
$(".dialog").show(); 
} 
//关闭灰色 jQuery 遮罩 
function closeBg() { 
$(".fullbg,.dialog").hide(); 
} 
</script>
<!-----------------------------主体内容 开始------------------------------>
  <div data-role="main" class="ui-content">

  <!------6等级 开始------->
  <volist name="list" id="v" key="k">
    <!--1-->
    <p>
    <div class=" float_l modular_w74p color_yellow1">
        <div class="pad_5">
          <div class="grade">{$k}.{$v.name}</div>
          <div class="harvest">{$Think.lang.__MEITIAN__}{$v.income}{$Think.lang.__GELUNKASHOUYI__}</div>
        </div>
    </div>
    <a  <eq name="v.status" value="1" > href="javascript:showBg({$v.lk_id})" </eq> class="popup_basic1">
      <div class="float_r modular_w23p color_yellow1">
        <div class=" pad_5 textalign_c">
          <div class="buy_car"><i class="iconfont icon-216"></i></div>
          <div class=""><eq name="v.status" value="1">${$v.price}</eq><eq name="v.status" value="0">待开放</eq><eq name="v.status" value="-1">售罄</eq></div>
        </div>
      </div>
    </a>
    </p>
    <div class="clear"></div>
    <!--1-->
   </volist>
    <!--购买select弹窗 开始-->
     <div class="fullbg" onClick="closeBg();"></div>
    <div class="dialog">
      <!--<p class="close"><a href="#" onClick="closeBg();">关闭</a></p>-->
      <div>
		{$Think.lang.__QINGXUANZEWEISHUIGOUMAI__}
        <form class="popup_form" method="post" action="" onsubmit="return false;">
          <fieldset data-role="fieldcontain">
			<input type="hidden" id="type" value="">
            <select data-native-menu="false" name="member">
				<option value="0">{$Think.lang.__ZIJI__}</option>
				<volist name="junior" id="vo">
					<option value="{$vo.phone}">{$vo.name}</option>
				</volist>
            </select>
          </fieldset>
          <input type="button" data-inline="true" onclick="ajaxSubmit()" value="提交">
        </form>
      </div>
    </div>
    <!--购买select弹窗 结束-->
  <!------6等级 结束------->
  <!------提示语 开始------->
    <div class="textcolor_yellow1">
      <div class="logo1_w70p textalign_c">
        <span>{$Think.lang.__ZHUANGENGDUONEIRONG1__}</span><br>
        <span>{$Think.lang.__ZHUANGENGDUONEIRONG2__}</span><br>
        <span class="sizeem13">{$Think.lang.__ZHUANGENGDUONEIRONG3__}</span>
      </div>
    </div>
    <div class="clear"></div>
  <!------提示语 结束------->
  </div>
<!-----------------------------主体内容 结束------------------------------>
<script type="text/javascript">
	function ajaxSubmit(){
		var id = $("#type").val();
		
		var phone = $("[name='member']").val();
		if(phone == 0){
			var url = "{:U('Buy/buyForSelf')}";
		}else{
			var url = "{:U('Buy/buyForOther')}";
		}
		
		$.ajax({
			url:url,
			type:"POST",
			data:{'phone':phone,'machine_id':id},
			dataType:"json",
			success:function(data){
				layer.msg(data.info);
				if(data.status){
					setTimeout(function(){location.replace(location);},2000);
				}
			}
		})
	}
</script>
<include file="App/Home/View/Public/footer.html"/>
<script>

		var popup = {
			body: '<p>This is a dead-simple popup!<br>The message can be filled with anything you want.</p>',
			buttons: {
				cancel: {
					title: 'Dismiss',
					class: basicModal.THEME.xclose,
					fn: basicModal.close
				}
			}
		}

		document.addEventListener('DOMContentLoaded', function() {

			document.querySelector('a.popup_basic1').addEventListener('tap', function() { basicModal.show(popup_basic1) })

		})

</script>